﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BusinessEntities.Model;
using System.Security.Cryptography;
namespace BusinessLayer
{
    public static class Extensions
    {
        public static string CreateHash(this User user)
        {
            MD5 md5 = MD5.Create();
            string toHash = user.Email.ToLower() + "yorkin";
            StringBuilder hash = new StringBuilder();
            foreach (byte b in md5.ComputeHash(Encoding.ASCII.GetBytes(toHash)))
            {
                hash.Append(b.ToString("x2").ToLower());
            }
            return hash.ToString();
        }
    }
}
